home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / c / supralib / developer / source.org / freenewimg.c < prev    next >
C/C++ Source or Header  |  1999-06-14  |  785b  |  37 lines

  1. /****** FreeNewImg *****************************************************
  2. *
  3. *   NAME
  4. *       FreeNewImg -- frees memory allocated by MakeNewImg() (V10)
  5. *
  6. *   SYNOPSIS
  7. *       FreeNewImg(newImage)
  8. *
  9. *       void FreeNewImg(struct Image *);
  10. *
  11. *   FUNCTION
  12. *       You must free a new created image with this function, when
  13. *       it is no longer needed.
  14. *
  15. *   SEE ALSO
  16. *       MakeNewImg()
  17. *
  18. ****************************************************************/
  19.  
  20. #include <proto/exec.h>
  21. #include <intuition/intuition.h>
  22.  
  23. void FreeNewImg(struct Image *img)
  24. {
  25. UWORD i=0;
  26. WORD wid=img->Width;
  27.  
  28.     /* Get width word aligned */
  29.     while (i < wid) i+=16;
  30.     wid = i;
  31.  
  32.     /* Free Memory */
  33.     FreeMem(img->ImageData, wid*img->Height*img->Depth/8);
  34.     FreeMem(img, sizeof(struct Image));
  35. }  
  36.  
  37.